<?php
include_once('prepend.inc.php');
include_once('encrypt.class.php');


class Login
{
	protected $AuthUser;
	protected $blnFinal;
	
	function Login_Validate($User,$Password)
	{
		echo($Password);
		$_SESSION['User'] = '';
		$this->AuthUser = new Memberdetails();
		
		$conditions = QQ::Equal(QQN::Memberdetails()->MemberId,$User);
		$this->AuthUser = Memberdetails::QuerySingle($conditions);

		if(!isset($this->AuthUser))
		{
			$_SESSION['User'] = '';	
			return 'Wrong';
		}
		else
		{
			$encrypt = new encrypt();
			$storedpass = $encrypt->decrypt_sha1($this->AuthUser->Password);
			
			
			if($storedpass <> $Password)
			{
				$_SESSION['User'] = '';
				return 'Wrong';
			}
			else
			{ 
				$_SESSION['objUser'] = $this->AuthUser;
				return 'Right';
			}
		}

	}
}
?>